import pandas as pd

list=[[110,120,105],[95,110,108],[98,80,100],[112,107,97]]
index = ["贡景超","贡景超牛子","贡景超牛比","贡景超吃肆"]
columns = ["唱","跳","Rap"]
df= pd.DataFrame(list,index,columns)
print("原始数据：\n",df)
print("选取所有学生成绩：\n",df)
print("选取所有学生唱和跳成绩：\n",df[["唱","跳"]])
print("选取贡景超和贡景超牛子的唱和Rap成绩：\n",df[["唱","Rap"]]["贡景超":"贡景超牛子"])
print("选取贡景超牛子以及其后面的成绩：\n",df[["唱","跳","Rap"]]["贡景超":])

print("原始数据：\n",df)
print("选取贡景超所有的额成绩：\n",df.loc["贡景超"])
print("选取贡景超和贡景超吃肆的所有成绩：\n",df.loc[["贡景超","贡景超吃肆"]])
print("选取贡景超到贡景超牛比的所有有成绩：\n",df.loc["贡景超":"贡景超牛比"])
print("选取贡景超和贡景超牛比的唱跳成绩：\n",df.loc[["贡景超","贡景超牛比"],["唱","跳"]])
print("选取贡景超和贡景超牛比的唱Rap成绩：\n",df.loc["贡景超":"贡景超牛比",["唱","Rap"]])




print("原始数据：\n",df)
print("选取贡景超所有的额成绩：\n",df.iloc[0])
print("选取贡景超和贡景超吃肆的所有成绩：\n",df.iloc[[0,3]])
print("选取贡景超到贡景超牛比的所有有成绩：\n",df.iloc[0:3])
print("选取贡景超和贡景超牛比的唱跳成绩：\n",df.iloc[[0,2],[0,1]])
print("选取贡景超和贡景超牛比的唱Rap成绩：\n",df.iloc[0:3,[0,2]])